//
//  cwRadioAppDelegate.h
//  cwRadio
//
//  Created by Niels Buekers on 12/11/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVPlayer.h>
#import <AVFoundation/AVPlayerItem.h>
#import <CoreLocation/CoreLocation.h>
#import "TBXML.h"
#import "locationController.h"

@class GCDAsyncSocket;
//we use enum instead of string so we can save memory
typedef enum{rock,metal,soundtrack,reggae,hiphop,classic}genres;

@interface cwRadioAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate,UITextFieldDelegate,locationControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;
		GCDAsyncSocket *asyncSocket;
	AVPlayer *player;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;




//functions for parsing the data
-(void) parseData:(NSString*) data;
-(void) parseNewTracklist:(TBXMLElement*) root firstTrack:(TBXMLElement*) track;
-(void) parseNewGrouplist:(TBXMLElement*) root firstGroup:(TBXMLElement*) group;
-(void) parseNewPlaylist:(TBXMLElement*) root firstTrack:(TBXMLElement*) track;
-(NSInteger) getGenrenr:(NSString*)str;

//locatie: functies to find groups in the neighbourhood
-(void) locationUpdate:(CLLocation*)location;
-(void) locationError:(NSError *)error;

//sending a file specifying a group to join or for voting on a genre
-(void) joinGroup:(NSString*)groep;
-(void) voteGenre:(NSString *)g;

//the functionality of the streamplayer
-(void) playSong;
@end

@interface UIAlertView (Extended)
- (UITextField*)addTextFieldWithValue:(NSString*)value label:(NSString*)label;
- (UITextField*)textFieldAtIndex:(NSUInteger)index;
- (NSUInteger)textFieldCount;
- (UITextField*)textField;
@end
